package com.supos.progress.entity;

import java.io.Serializable;
import java.util.List;

/**
 */
public class Output implements Serializable {
    private String titleOrName;
    private Integer ratio;
    private List<Output> child;

    public String getTitleOrName() {
        return titleOrName;
    }

    public void setTitleOrName(String titleOrName) {
        this.titleOrName = titleOrName;
    }

    public Integer getRatio() {
        if (ratio != null) return ratio;
        if (child == null || child.isEmpty())
            return 0;
        return child.stream().mapToInt(Output::getRatio).sum() / child.size();
    }

    public void setRatio(Integer ratio) {
        this.ratio = ratio;
    }

    public List<Output> getChild() {
        return child;
    }

    public void setChild(List<Output> child) {
        this.child = child;
    }
}
